#ifndef __CORE_TASK_H__
#define __CORE_TASK_H__

#include <functional>
#include <list>
#include <mutex>
#include "core_thread.h"

class CoreTask
{
private:
	typedef std::function<void()> Task;
	std::list<Task> _tasks;
	std::list<Task> _tasksBuf;
	std::mutex mymutex;
	CoreThread cthread;

public:
	CoreTask();
	~CoreTask();

	void addTask(Task task);
	void start();
	void stop();

private:
	void onRun(CoreThread* pthread);
};


#endif // !__CORE_TASK_H__
